FUNCTION ZFIFM_VIM_GET_INV_PROCESSOR.
*"----------------------------------------------------------------------
*"*"本地接口：
*"  IMPORTING
*"     REFERENCE(PRODUCTCODE) LIKE  /PTGWFI/W_ROLE-ZPDCD
*"     REFERENCE(RESPONSIBLEPARTY) LIKE  /PTGWFI/W_ROLE-ZRSP
*"     REFERENCE(OBJTYPE) LIKE  SWOTBASDAT-OBJTYPE
*"     REFERENCE(OBJKEY) LIKE  SWOTOBJID-OBJKEY
*"  TABLES
*"      ACTOR_TAB STRUCTURE  SWHACTOR
*"  EXCEPTIONS
*"      NOBODY_FOUND
*"----------------------------------------------------------------------

  CLEAR: ACTOR_TAB, ACTOR_TAB[].

  DATA:
    LV_JSDDH TYPE ZFIT079_HEAD-JSDDH,
    LV_DOCID TYPE /OPT/DOCID,
    LV_USER  TYPE /OPT/ARUSER,
    LS_RED   TYPE /OPT/BL_USER_RED.

  IF OBJTYPE = '/OPT/V1001'.
    LV_DOCID = OBJKEY.

    "取发票结算单最后修改人作为DP处理人
    SELECT SINGLE
      CUSTOM_FIELD0
      INTO @DATA(LV_CUSTOM_FIELD0)
      FROM /OPT/VIM_1HEAD
     WHERE DOCID = @LV_DOCID.

    IF SY-SUBRC = 0.
      LV_JSDDH = LV_CUSTOM_FIELD0.

      SELECT SINGLE *
        INTO @DATA(LS_ZFIT079_HEAD)
        FROM ZFIT079_HEAD
       WHERE JSDDH = @LV_JSDDH.

*      IF LS_ZFIT079_HEAD-CHNAM IS NOT INITIAL.
*        LV_USER = LS_ZFIT079_HEAD-CHNAM.
*      ELSE.
      LV_USER = LS_ZFIT079_HEAD-CRNAM.
*      ENDIF.

      ACTOR_TAB-OTYPE = 'US'.
      ACTOR_TAB-OBJID = LV_USER.
      APPEND ACTOR_TAB.
    ENDIF.

    "User redirect
    IF ACTOR_TAB-OBJID IS NOT INITIAL.
      SELECT SINGLE * INTO CORRESPONDING FIELDS OF LS_RED
        FROM /OPT/BL_USER_RED
       WHERE ZPDCD = PRODUCTCODE
         AND ZRSP_FROM = RESPONSIBLEPARTY
         AND OBJID = ACTOR_TAB-OBJID.
      IF SY-SUBRC EQ 0.
        CALL FUNCTION '/PTGWFI/COA_W_RETRIEVE_USERS'
          EXPORTING
            ZPDCD             = PRODUCTCODE
            ZRSP              = LS_RED-ZRSP_TO
            OBJTYPE           = OBJTYPE
            OBJKEY            = OBJKEY
          TABLES
            USERLIST          = ACTOR_TAB
          EXCEPTIONS
            ROLE_NOT_RESOLVED = 1
            OTHERS            = 2.
        IF SY-SUBRC <> 0 OR ACTOR_TAB[] IS INITIAL.
          RAISE NOBODY_FOUND.
        ENDIF.
      ENDIF.
    ENDIF.

  ENDIF.

ENDFUNCTION.
